package org.bozo.im.common.types;

import android.os.Parcel;
import android.os.Parcelable;

public class AccountDesc implements Parcelable {

	// ---------------------------------------------------------------------------------------
	// Variables
	// ---------------------------------------------------------------------------------------
	
	private String mLoginName;
	private Protocol mProtocol;
	private String mPassword;
	private int mPort;
	private String mServer;
	

	// ---------------------------------------------------------------------------------------
	// Getters
	// ---------------------------------------------------------------------------------------
	
	public String getLoginName() {
		return mLoginName;
	}
	public Protocol getProtocol() {
		return mProtocol;
	}
	public String getPassword() {
		return mPassword;
	}
	public int getPort() {
		return mPort;
	}
	public String getServer() {
		return mServer;
	}
	
	

	// ---------------------------------------------------------------------------------------
	// Setters
	// ---------------------------------------------------------------------------------------
	
	public void setLoginName(String pLoginName) {
		mLoginName = pLoginName;
	}
	public void setProtocol(Protocol pProtocol) {
		mProtocol = pProtocol;
	}
	public void setPassword(String pPassword) {
		mPassword = pPassword;
	}
	public void setPort(int pPort) {
		mPort = pPort;
	}
	public void setServer(String pServer) {
		mServer = pServer;
	}
	
	public int describeContents() {
		return 0;
	}
	
	public void writeToParcel(Parcel pDest, int pFlags) {
		pDest.writeString(getLoginName());
		pDest.writeString(getPassword());
		pDest.writeString(getServer());
		pDest.writeInt(getPort());
		pDest.writeParcelable(getProtocol(), 0);
	}
	
	public static final Parcelable.Creator<AccountDesc> CREATOR = new Parcelable.Creator<AccountDesc>() {

		public AccountDesc createFromParcel(Parcel pSource) {
			
			AccountDesc lRes = new AccountDesc();
			lRes.setLoginName(pSource.readString());
			lRes.setPassword(pSource.readString());
			lRes.setServer(pSource.readString());
			lRes.setPort(pSource.readInt());
			lRes.setProtocol((Protocol)pSource.readParcelable(getClass().getClassLoader()));
			
			return lRes;
		}

		public AccountDesc[] newArray(int pSize) {
			return new AccountDesc[pSize];
		}
	};
}
